FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 8087

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY MatrixWebApiCore/MatrixWebApiCore.csproj MatrixWebApiCore/
COPY MatrixWebApiCore.Entity/MatrixWebApiCore.Entity.csproj MatrixWebApiCore.Entity/
COPY MatrixWebApiCore.Dao/MatrixWebApiCore.Dao.csproj MatrixWebApiCore.Dao/
COPY MatrixWebApiCore.Common/MatrixWebApiCore.Common.csproj MatrixWebApiCore.Common/
COPY MatrixWebApiCore.IDao/MatrixWebApiCore.IDao.csproj MatrixWebApiCore.IDao/
RUN dotnet restore MatrixWebApiCore/MatrixWebApiCore.csproj
COPY . .
WORKDIR /src/MatrixWebApiCore
RUN dotnet build MatrixWebApiCore.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish MatrixWebApiCore.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MatrixWebApiCore.dll"]
